package com.wxd.dataSwitch;

import com.alibaba.fastjson.JSON;
import com.wxd.modules.function.entity.EmpEntity;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.List;


@Component
@RabbitListener(queues = "topic.jwd")
public class TopicJwdConsumer {

    /**
     * 消息消费
     * @RabbitHandler 代表此方法为接受到消息后的处理方法
     */
    @RabbitHandler
    public void recieved(String msg) {
        List<EmpEntity> empEntityList = JSON.parseArray(msg, EmpEntity.class);
        System.out.println("[topic.jwd] recieved message:" + empEntityList);
    }
}